package com.liliudong.makabaka.controller.sys;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.liliudong.makabaka.common.R;
import com.liliudong.makabaka.sys.dto.SysDictGroupPageQuery;
import com.liliudong.makabaka.sys.entity.SysDictGroup;
import com.liliudong.makabaka.sys.service.SysDictGroupService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统字典分组控制器
 *
 * @author liudo
 * @version 1.0
 * @project makabaka-backend
 * @date 2023/9/24 16:48:07
 */
@RestController
@RequestMapping("/v1/sys-dict-group")
@RequiredArgsConstructor
public class SysDictGroupController {

    private final SysDictGroupService sysDictGroupService;

    /**
     * 页
     *
     * @param sysDictGroupPageQuery sys dict组页面查询
     * @return {@link R}<{@link Page}<{@link SysDictGroup}>>
     */
    @GetMapping("/page")
    public R<Page<SysDictGroup>> page(SysDictGroupPageQuery sysDictGroupPageQuery) {
        Page<SysDictGroup> page = sysDictGroupService.page(new Page<>(sysDictGroupPageQuery.getPage(), sysDictGroupPageQuery.getPageSize()));
        return R.success(page);
    }
}
